package com.entor.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import com.entor.service.FileService;
import com.entor.util.Msg;

@Controller
@RequestMapping("/file")
public class FileController {
	
	@Resource(name="fileService")
	private FileService fs;
	
	@RequestMapping("/out")
	public String out(){
		return "/out";
	}
	@RequestMapping("/in")
	public String in(){
		return "/in";
	}
	
	@RequestMapping("/outFile")
	@ResponseBody
	public Msg outFile(HttpServletRequest req){
		String outFilename = req.getParameter("outFileName");
		return fs.outFile(outFilename);
	}
	
	@RequestMapping("/inFile")
	@ResponseBody
	public Msg inFile(
			@RequestParam(required=false,value="inFile")
			MultipartFile file){
		return fs.inFile(file);
	}
	
	
	
	
	

}
